package testUnit;

import static org.junit.Assert.*;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.PrintStream;
import java.lang.reflect.Method;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import FamilyTherapy.EventCard;
import FamilyTherapy.Player;
import FamilyTherapy.GCWindow;
import FamilyTherapy.Game;
import FamilyTherapy.SayActCard;
import FamilyTherapy.MagicToolCard;

public class testGame {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGame() {
		boolean isNew = false;
		Game game = new Game();

		if (game != null)
			isNew = true;
		assertEquals(true, isNew);
	}

	@Test
	public void testGetSetNoOfPlayer() {
		Game game = new Game();
		game.setNoOfPlayer(1);
		int result = game.getNoOfPlayer();
		assertEquals(result, 1);
	}
	
	@Test
	public void rollDice_1() throws Exception {

		//preparation
		boolean expected = true;
		boolean actual=false;

		//the class the contain the private method to be tested
		Game tg = Game.class.newInstance();

		//the method to be tested
		Method rollDice = tg.getClass().getDeclaredMethod("rollDice");

		//set accessible and test
		rollDice.setAccessible(true);
		Object actualResult = rollDice.invoke(tg);
		rollDice.setAccessible(false);
		
		//for tracing
		//System.out.println(actualResult);
		
		if ((Integer)actualResult > 0 && (Integer)actualResult < 6)
			actual=true;
			
		assertEquals(expected, actual);
	}
}
